# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=afflib
_pkgname=AFFLIBv3
pkgver=3.7.22
pkgrel=2
groups=('blackarch' 'blackarch-forensic')
pkgdesc='An extensible open format for the storage of disk images and related forensic information.'
arch=('x86_64' 'aarch64')
url='https://github.com/sshock/AFFLIBv3'
license=('custom:unknown')
depends=('ncurses' 'zlib' 'openssl' 'curl' 'expat' 'readline' 'fuse2' 'fuse3')
source=("https://github.com/sshock/AFFLIBv3/archive/v$pkgver.tar.gz")
sha512sums=('d649ce8198d8e6f05b6ba503fd9b454fceb06bf182dec8bc135eb126ad4b100301d7c4fc9ef6dac0f3d98edd785133bc841332333634f4534b8f51041ba51f43')

build() {
  cd "$_pkgname-$pkgver"

  sh bootstrap.sh

  if [[ "$CARCH" == "aarch64" ]];
  then
    ./configure \
      --build=arm \
      --prefix=/usr \
      --sysconfdir=/etc \
      --enable-fuse \
      --enable-s3
  else
    ./configure \
      --prefix=/usr \
      --sysconfdir=/etc \
      --enable-fuse \
      --enable-s3
  fi

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

